package cheme.Application.actions;

import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.internal.SaveAction;

import cheme.Application.ChemeApplicationConstants;

public class SaveFileAction extends SaveAction
{
	/**
     * The workbench window this action is registered with.
     */
    private IWorkbenchWindow workbenchWindow;
    
    public SaveFileAction(IWorkbenchWindow window)
    {
        //super(WorkbenchMessages.SaveAction_text, window); 
    	
    	super(window);
        
    	if (window == null)
        {
            throw new IllegalArgumentException();
        }
    	
        workbenchWindow = window;
        
        setText(ChemeApplicationConstants.SAVE_FILE_ACTION_TEXT);
        setToolTipText(ChemeApplicationConstants.SAVE_FILE_ACTION_TOOLTIP);
        setId("save"); //$NON-NLS-1$
        
        //window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.SAVE_ACTION);
        
        setImageDescriptor(ChemeApplicationConstants.DESC_SAVE);
        setDisabledImageDescriptor(ChemeApplicationConstants.DESC_SAVE_DISABLED);
        
        setActionDefinitionId("org.eclipse.ui.file.save"); //$NON-NLS-1$
    }

	@Override
	public void run()
	{
		workbenchWindow.getActivePage().getActiveEditor().doSave(null);
//		super.run();
	}
}